# -*- coding: utf-8 -*-
# @Author : Yuan
from rest_framework import serializers
from apps.goods.models import GoodsChannel, GoodsChannelGroup, GoodsCategory


class GoodsChannelModelSerializer(serializers.ModelSerializer):
    group_id = serializers.IntegerField()
    group = serializers.StringRelatedField(read_only=True)
    category_id = serializers.IntegerField()
    category = serializers.StringRelatedField(read_only=True)

    class Meta:
        model = GoodsChannel
        fields = '__all__'


class GoodsChannelGroupModelSerializer(serializers.ModelSerializer):

    class Meta:
        model = GoodsChannelGroup
        fields = ['id', 'name']


class GoodsCategoryModelSerializer(serializers.ModelSerializer):

    class Meta:
        model = GoodsCategory
        fields = ['id', 'name']

